#!/usr/bin/perl

use warnings;
use strict;
use lib '../lib';
use Geo::Coder::GoogleMaps;
my $response;
my $location;
my $gmap = Geo::Coder::GoogleMaps->new( apikey => $ENV{GAPI_KEY} , output => 'xml');
eval{
	$response = $gmap->geocode( location => "$ARGV[0]" );
};
print "Done geocoding !\n";
if($@){
	die "Error while geocoding :\n\t$@\n";
} else {
	$location = $response->placemarks()->[0];
	print "Location:\n",$location->Serialize(1),"\n";
}

print "North: ",$location->LLB_north,"\nSouth: ",$location->LLB_south,"\n East: ",$location->LLB_east,"\n West: ",$location->LLB_west,"\n";
